
using Microsoft.Extensions.DependencyInjection;
using Platform.Core;
using VisionDemo.Application.CameraModels.ViewModels;
using VisionDemo.Application.MainModels.ViewModels;
using VisionDemo.Application.RunModels.ViewModels;

namespace VisionDemo.Ioc
{
    public class ModelLocator
    {
        public ModelLocator() 
        {
            Services = ConfigureServices();
        }
        public IServiceProvider Services { get; }
        public MainViewModel MainViewModel => Services.GetService<MainViewModel>();
        public RunViewModel RunViewModel => Services.GetService<RunViewModel>();
        public CameraViewModel CameraViewModel => Services.GetService<CameraViewModel>();
        private static IServiceProvider ConfigureServices()
        {
            var services = new ServiceCollection();

            services.InitCoreModule();
            services.AddSingleton<MainViewModel>();
            services.AddSingleton<RunViewModel>();
            services.AddSingleton<CameraViewModel>();
            return services.BuildServiceProvider();
        }
    }

}
